
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh_Hans">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>SchemaEditor &#8212; Django 3.2.11.dev 文档</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="next" title="配置" href="settings.html" />
    <link rel="prev" title="请求和响应对象" href="request-response.html" />



 
<script src="../templatebuiltins.js"></script>
<script>
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../index.html">Django 3.2.11.dev 文档</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../index.html">Home</a>  |
        <a title="Table of contents" href="../contents.html">Table of contents</a>  |
        <a title="Global index" href="../genindex.html">Index</a>  |
        <a title="Module index" href="../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="request-response.html" title="请求和响应对象">previous</a>
     |
    <a href="index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="settings.html" title="配置">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-schema-editor">
            
  <div class="section" id="s-module-django.db.backends.base.schema">
<span id="s-schemaeditor"></span><span id="module-django.db.backends.base.schema"></span><span id="schemaeditor"></span><h1><code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code><a class="headerlink" href="#module-django.db.backends.base.schema" title="永久链接至标题">¶</a></h1>
<dl class="class">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor">
<em class="property">class </em><code class="descname">BaseDatabaseSchemaEditor</code><a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>Django 的迁移系统分为两部分，一部分是计算和存储应该运行哪些操作的逻辑（<code class="docutils literal notranslate"><span class="pre">django.db.migrations</span></code>），另一部分是将“创建模型”或“删除字段”这样的事情变成 SQL 的数据库抽象层——这是 <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code> 的工作。</p>
<p>作为一个使用 Django 的普通开发者，你不太可能想直接与 <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code> 进行交互，但如果你想写自己的迁移系统，或者有更高级的需求，它比写 SQL 要好得多。</p>
<p>Django 中的每个数据库后端都提供了自己的 <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code> 版本，并且总是通过 <code class="docutils literal notranslate"><span class="pre">connection.schema_editor()</span></code> 上下文管理器：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">connection</span><span class="o">.</span><span class="n">schema_editor</span><span class="p">()</span> <span class="k">as</span> <span class="n">schema_editor</span><span class="p">:</span>
    <span class="n">schema_editor</span><span class="o">.</span><span class="n">delete_model</span><span class="p">(</span><span class="n">MyModel</span><span class="p">)</span>
</pre></div>
</div>
<p>它必须通过上下文管理器使用，因为这允许它管理诸如事务和延迟 SQL（如创建 <code class="docutils literal notranslate"><span class="pre">ForeignKey</span></code> 约束）的事情。</p>
<p>它将所有可能的操作以方法的形式展现出来，这些方法应该按照你希望的改变顺序被调用。有些可能的操作或更改类型并不是在所有的数据库中都能实现——例如，MyISAM 不支持外键约束。</p>
<p>如果你正在为 Django 编写或维护一个第三方数据库后端，你将需要提供一个 <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code> 的实现，以便与 Django 的迁移功能一起工作——不过，只要你的数据库在使用 SQL 和关系型设计方面比较标准，你应该能够将 Django 内置的 <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code> 类子类化，并对语法进行一些调整。</p>
<div class="section" id="s-methods">
<span id="methods"></span><h2>方法<a class="headerlink" href="#methods" title="永久链接至标题">¶</a></h2>
<div class="section" id="s-execute">
<span id="execute"></span><h3><code class="docutils literal notranslate"><span class="pre">execute()</span></code><a class="headerlink" href="#execute" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.execute">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">execute</code>(<em>sql</em>, <em>params=()</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.execute" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>执行传入的 SQL 语句，如果提供参数，则执行。这是一个围绕普通数据库游标的包装器，如果用户愿意，允许捕获 SQL 语句到 <a href="#id1"><span class="problematic" id="id2">``</span></a>.sql` <a href="#id3"><span class="problematic" id="id4">`</span></a>文件。</p>
</div>
<div class="section" id="s-create-model">
<span id="create-model"></span><h3><code class="docutils literal notranslate"><span class="pre">create_model()</span></code><a class="headerlink" href="#create-model" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.create_model">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">create_model</code>(<em>model</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.create_model" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>在数据库中为所提供的模型创建一个新表，以及它所需要的任何唯一约束或索引。</p>
</div>
<div class="section" id="s-delete-model">
<span id="delete-model"></span><h3><code class="docutils literal notranslate"><span class="pre">delete_model()</span></code><a class="headerlink" href="#delete-model" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.delete_model">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">delete_model</code>(<em>model</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.delete_model" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>将模型的表连同它所拥有的任何唯一约束或索引一起在数据库中丢弃。</p>
</div>
<div class="section" id="s-add-index">
<span id="add-index"></span><h3><code class="docutils literal notranslate"><span class="pre">add_index()</span></code><a class="headerlink" href="#add-index" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_index">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">add_index</code>(<em>model</em>, <em>index</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_index" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>在 <code class="docutils literal notranslate"><span class="pre">model</span></code> 的表中添加 <code class="docutils literal notranslate"><span class="pre">index</span></code>。</p>
</div>
<div class="section" id="s-remove-index">
<span id="remove-index"></span><h3><code class="docutils literal notranslate"><span class="pre">remove_index()</span></code><a class="headerlink" href="#remove-index" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_index">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">remove_index</code>(<em>model</em>, <em>index</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_index" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>将 <code class="docutils literal notranslate"><span class="pre">index</span></code> 从 <code class="docutils literal notranslate"><span class="pre">model</span></code> 的表中删除。</p>
</div>
<div class="section" id="s-add-constraint">
<span id="add-constraint"></span><h3><code class="docutils literal notranslate"><span class="pre">add_constraint()</span></code><a class="headerlink" href="#add-constraint" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_constraint">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">add_constraint</code>(<em>model</em>, <em>constraint</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_constraint" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>在 <code class="docutils literal notranslate"><span class="pre">model</span></code> 的表中添加 <code class="docutils literal notranslate"><span class="pre">constraint</span></code>。</p>
</div>
<div class="section" id="s-remove-constraint">
<span id="remove-constraint"></span><h3><code class="docutils literal notranslate"><span class="pre">remove_constraint()</span></code><a class="headerlink" href="#remove-constraint" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_constraint">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">remove_constraint</code>(<em>model</em>, <em>constraint</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_constraint" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>将 <code class="docutils literal notranslate"><span class="pre">constraint</span></code> 从 <code class="docutils literal notranslate"><span class="pre">model</span></code> 的表中删除。</p>
</div>
<div class="section" id="s-alter-unique-together">
<span id="alter-unique-together"></span><h3><code class="docutils literal notranslate"><span class="pre">alter_unique_together()</span></code><a class="headerlink" href="#alter-unique-together" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_unique_together">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">alter_unique_together</code>(<em>model</em>, <em>old_unique_together</em>, <em>new_unique_together</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_unique_together" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>改变模型的 <a class="reference internal" href="models/options.html#django.db.models.Options.unique_together" title="django.db.models.Options.unique_together"><code class="xref py py-attr docutils literal notranslate"><span class="pre">unique_together</span></code></a> 值；这将从模型的表中添加或删除唯一约束，直到它们与新的值相匹配。</p>
</div>
<div class="section" id="s-alter-index-together">
<span id="alter-index-together"></span><h3><code class="docutils literal notranslate"><span class="pre">alter_index_together()</span></code><a class="headerlink" href="#alter-index-together" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_index_together">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">alter_index_together</code>(<em>model</em>, <em>old_index_together</em>, <em>new_index_together</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_index_together" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>更改模型的 <a class="reference internal" href="models/options.html#django.db.models.Options.index_together" title="django.db.models.Options.index_together"><code class="xref py py-attr docutils literal notranslate"><span class="pre">index_together</span></code></a> 值；这将从模型的表中添加或删除索引，直到它们与新值相匹配。</p>
</div>
<div class="section" id="s-alter-db-table">
<span id="alter-db-table"></span><h3><code class="docutils literal notranslate"><span class="pre">alter_db_table()</span></code><a class="headerlink" href="#alter-db-table" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_db_table">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">alter_db_table</code>(<em>model</em>, <em>old_db_table</em>, <em>new_db_table</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_db_table" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>将模型的表从 <code class="docutils literal notranslate"><span class="pre">old_db_table</span></code> 改名为 <code class="docutils literal notranslate"><span class="pre">new_db_table</span></code>。</p>
</div>
<div class="section" id="s-alter-db-tablespace">
<span id="alter-db-tablespace"></span><h3><code class="docutils literal notranslate"><span class="pre">alter_db_tablespace()</span></code><a class="headerlink" href="#alter-db-tablespace" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_db_tablespace">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">alter_db_tablespace</code>(<em>model</em>, <em>old_db_tablespace</em>, <em>new_db_tablespace</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_db_tablespace" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>将模型的表从一个表空间移动到另一个表空间。</p>
</div>
<div class="section" id="s-add-field">
<span id="add-field"></span><h3><code class="docutils literal notranslate"><span class="pre">add_field()</span></code><a class="headerlink" href="#add-field" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_field">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">add_field</code>(<em>model</em>, <em>field</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_field" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>在模型的表中添加一列（或有时是多列）来表示该字段。如果字段有 <code class="docutils literal notranslate"><span class="pre">db_index=True</span></code> 或 <code class="docutils literal notranslate"><span class="pre">unique=True</span></code>，还将添加索引或唯一约束。</p>
<p>如果字段是 <code class="docutils literal notranslate"><span class="pre">ManyToManyField</span></code>，没有 <code class="docutils literal notranslate"><span class="pre">through</span></code> 的值，它将不创建一列，而是制作一个表来表示这种关系。如果提供了 <code class="docutils literal notranslate"><span class="pre">through</span></code>，则为无操作。</p>
<p>如果字段是 <code class="docutils literal notranslate"><span class="pre">ForeignKey</span></code>，这也会将外键约束添加到列中。</p>
</div>
<div class="section" id="s-remove-field">
<span id="remove-field"></span><h3><code class="docutils literal notranslate"><span class="pre">remove_field()</span></code><a class="headerlink" href="#remove-field" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_field">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">remove_field</code>(<em>model</em>, <em>field</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_field" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>从模型的表中删除代表字段的列，以及由该字段引起的任何唯一约束、外键约束或索引。</p>
<p>如果字段是一个 ManyToManyField，没有 <code class="docutils literal notranslate"><span class="pre">through</span></code> 的值，它将删除为跟踪关系而创建的表。如果提供了 <code class="docutils literal notranslate"><span class="pre">through</span></code>，则为无操作。</p>
</div>
<div class="section" id="s-alter-field">
<span id="alter-field"></span><h3><code class="docutils literal notranslate"><span class="pre">alter_field()</span></code><a class="headerlink" href="#alter-field" title="永久链接至标题">¶</a></h3>
<dl class="method">
<dt id="django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_field">
<code class="descclassname">BaseDatabaseSchemaEditor.</code><code class="descname">alter_field</code>(<em>model</em>, <em>old_field</em>, <em>new_field</em>, <em>strict=False</em>)<a class="headerlink" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.alter_field" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>这将模型上的字段从旧字段转换为新字段。这包括改变列的名称（<a class="reference internal" href="models/fields.html#django.db.models.Field.db_column" title="django.db.models.Field.db_column"><code class="xref py py-attr docutils literal notranslate"><span class="pre">db_column</span></code></a> 属性），改变字段的类型（如果字段类发生变化），改变字段的 <code class="docutils literal notranslate"><span class="pre">NULL</span></code> 状态，添加或删除只属于字段的唯一约束和索引，改变主键，以及改变 <code class="docutils literal notranslate"><span class="pre">ForeignKey</span></code> 约束的目的地。</p>
<p>最常见的不能做的转换是将一个 <code class="docutils literal notranslate"><span class="pre">ManyToManyField</span></code> 转换为一个普通的 Field，反之亦然；Django 不能在不丢失数据的情况下这样做，所以它会拒绝这样做。相反， <a class="reference internal" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_field" title="django.db.backends.base.schema.BaseDatabaseSchemaEditor.remove_field"><code class="xref py py-meth docutils literal notranslate"><span class="pre">remove_field()</span></code></a> 和 <a class="reference internal" href="#django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_field" title="django.db.backends.base.schema.BaseDatabaseSchemaEditor.add_field"><code class="xref py py-meth docutils literal notranslate"><span class="pre">add_field()</span></code></a> 应该分别调用。</p>
<p>如果数据库有 <code class="docutils literal notranslate"><span class="pre">supports_combined_alters</span></code>，Django 会尝试在一次数据库调用中尽可能多地进行这些操作；否则，它会为每一个变化发出单独的 ALTER 语句，但不会在不需要变化的地方发出 ALTER。</p>
</div>
</div>
<div class="section" id="s-attributes">
<span id="attributes"></span><h2>属性<a class="headerlink" href="#attributes" title="永久链接至标题">¶</a></h2>
<p>除非另有说明，否则所有属性都应被视为只读。</p>
<div class="section" id="s-connection">
<span id="connection"></span><h3><code class="docutils literal notranslate"><span class="pre">connection</span></code><a class="headerlink" href="#connection" title="永久链接至标题">¶</a></h3>
<dl class="attribute">
<dt id="django.db.backends.base.schema.SchemaEditor.connection">
<code class="descclassname">SchemaEditor.</code><code class="descname">connection</code><a class="headerlink" href="#django.db.backends.base.schema.SchemaEditor.connection" title="永久链接至目标">¶</a></dt>
<dd></dd></dl>

<p>与数据库的连接对象。连接的一个有用属性是 <code class="docutils literal notranslate"><span class="pre">alias</span></code>，它可以用来确定被访问的数据库的名称。</p>
<p>这在为 <a class="reference internal" href="../howto/writing-migrations.html#data-migrations-and-multiple-databases"><span class="std std-ref">多数据库迁移</span></a> 进行数据迁移时很有用。</p>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code></a><ul>
<li><a class="reference internal" href="#methods">方法</a><ul>
<li><a class="reference internal" href="#execute"><code class="docutils literal notranslate"><span class="pre">execute()</span></code></a></li>
<li><a class="reference internal" href="#create-model"><code class="docutils literal notranslate"><span class="pre">create_model()</span></code></a></li>
<li><a class="reference internal" href="#delete-model"><code class="docutils literal notranslate"><span class="pre">delete_model()</span></code></a></li>
<li><a class="reference internal" href="#add-index"><code class="docutils literal notranslate"><span class="pre">add_index()</span></code></a></li>
<li><a class="reference internal" href="#remove-index"><code class="docutils literal notranslate"><span class="pre">remove_index()</span></code></a></li>
<li><a class="reference internal" href="#add-constraint"><code class="docutils literal notranslate"><span class="pre">add_constraint()</span></code></a></li>
<li><a class="reference internal" href="#remove-constraint"><code class="docutils literal notranslate"><span class="pre">remove_constraint()</span></code></a></li>
<li><a class="reference internal" href="#alter-unique-together"><code class="docutils literal notranslate"><span class="pre">alter_unique_together()</span></code></a></li>
<li><a class="reference internal" href="#alter-index-together"><code class="docutils literal notranslate"><span class="pre">alter_index_together()</span></code></a></li>
<li><a class="reference internal" href="#alter-db-table"><code class="docutils literal notranslate"><span class="pre">alter_db_table()</span></code></a></li>
<li><a class="reference internal" href="#alter-db-tablespace"><code class="docutils literal notranslate"><span class="pre">alter_db_tablespace()</span></code></a></li>
<li><a class="reference internal" href="#add-field"><code class="docutils literal notranslate"><span class="pre">add_field()</span></code></a></li>
<li><a class="reference internal" href="#remove-field"><code class="docutils literal notranslate"><span class="pre">remove_field()</span></code></a></li>
<li><a class="reference internal" href="#alter-field"><code class="docutils literal notranslate"><span class="pre">alter_field()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#attributes">属性</a><ul>
<li><a class="reference internal" href="#connection"><code class="docutils literal notranslate"><span class="pre">connection</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>上一个主题</h4>
  <p class="topless"><a href="request-response.html"
                        title="上一章">请求和响应对象</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="settings.html"
                        title="下一章">配置</a></p>
  <div role="note" aria-label="source link">
    <h3>本页</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/ref/schema-editor.txt"
            rel="nofollow">显示源代码</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>快速搜索</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="转向" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">12月 07, 2021</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="request-response.html" title="请求和响应对象">previous</a>
     |
    <a href="index.html" title="API 参考" accesskey="U">up</a>
   |
    <a href="settings.html" title="配置">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>